import { createRouter, createWebHistory } from 'vue-router';

const routes = [
  {
    path: '/',
    redirect: '/login',
  },
  {
    path: '/home',
    name:'Home',
    component: () => import('@/components/layout/index.vue'),
    children: [
      {
        // 当 /user/:id/profile 匹配成功
        // UserProfile 将被渲染到 User 的 <router-view> 内部
        path: 'index',
        component: () => import('@/view/home/index.vue')
      },
    ]
  },
  { 
    path: '/login',
    name:'Login',
    component: () => import('@/view/login/index.vue') 
  },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;
